/*
 * Copyright 2002-2017 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.core.type;

import org.springframework.lang.Nullable;

/**
 * Interface that defines abstract metadata of a specific class,
 * in a form that does not require that class to be loaded yet.
 *
 * @author Juergen Hoeller
 * @since 2.5
 * @see StandardClassMetadata
 * @see org.springframework.core.type.classreading.MetadataReader#getClassMetadata()
 * @see AnnotationMetadata
 *
 * Spring对类本身元数据的抽象建模接口。
 * 类名称，是否是一个接口，是否是一个注解，是否为抽象类，是否实现类(concrete)，
 * 是否final，是否被另外一个类包含(嵌套类的情况)，super类信息，所实现的接口的信息，内嵌类的信息。
 */
public interface ClassMetadata {

	/**
	 * 返回类名（原始的）
	 */
	String getClassName();

	/**
	 * 是否是接口
	 */
	boolean isInterface();

	/**
	 * 是否是注解
	 * @since 4.1
	 */
	boolean isAnnotation();

	/**
	 * 是否是抽象的
	 */
	boolean isAbstract();

	/**
	 * 是否允许创建，不是接口且不是抽象类，这里就返回true了
	 */
	boolean isConcrete();

	/**
	 * 是否被Final修饰
	 */
	boolean isFinal();

	/**
	 *
	 * 是否是独立的（Class、或者内部类、静态内部类）
	 */
	boolean isIndependent();

	/**
	 *是否有内部类之类的东东
	 */
	boolean hasEnclosingClass();

	/**
	 * Return the name of the enclosing class of the underlying class,
	 * or {@code null} if the underlying class is a top-level class.
	 */
	@Nullable
	String getEnclosingClassName();

	/**
	 * Return whether the underlying class has a super class.
	 * 是否有父类
	 */
	boolean hasSuperClass();

	/**
	 * Return the name of the super class of the underlying class,
	 * or {@code null} if there is no super class defined.
	 */
	@Nullable
	String getSuperClassName();


	/**
	 * Return the names of all interfaces that the underlying class
	 * implements, or an empty array if there are none.
	 *
	 * 会把实现的所有接口名称都返回
	 */
	String[] getInterfaceNames();

	/**
	 * Return the names of all classes declared as members of the class represented by
	 * this ClassMetadata object. This includes public, protected, default (package)
	 * access, and private classes and interfaces declared by the class, but excludes
	 * inherited classes and interfaces. An empty array is returned if no member classes
	 * or interfaces exist.
	 * @since 3.1
	 *
	 * 返回类中定义的公共、私有、保护的内部类
	 */
	String[] getMemberClassNames();

}
